<template>
	<!-- 帖子详情 -->
	<view style="padding: 15px;">
		<!-- 发帖用户信息 -->
		<view style="height: 40px;">
			<span style="color: #FE9F59; font-size: 18px; float: left;">{{ testData.userName }}</span>
			<span
				style="color: #838383; font-size: 8px; float: right; margin-top: 5px; margin-right: 5px;">{{ testData.createTime }}</span>
		</view>
		<!-- 帖子内容 -->
		<view>
			{{ testData.content }}
		</view>
		<!-- 评论 -->
		<view>
			<view v-for="">
				{{  }}
			</view>
		</view>
		
		<view style="width: 100%; display: flex; position:fixed; bottom: 10px;left: 0;">
			<u--input
			    placeholder="友好评论,共建和谐社区"
			    border="surround"
			    v-model="remark"
				shape="circle"
				style="min-width: 70%; margin: 2px; background-color: white;"
			  ></u--input>
			  <u-button style="width: 20%; margin: 2px; right: 2px;"  type="success" shape="circle" text="评论" @click="sending()"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				remark: '',
				testData: {
					id: '111',
					userName: '张三',
					createTime: '2025-01-01 10:10:10',
					content: '这是帖子的具体内容~',
					comment: [
						{
							userName: '李四',
							createTime: '2025-01-02 11:11:11',
							content: '这是评论内容',
							remark: [
								{
									userName: '李四',
									createTime: '2025-01-02 11:11:11',
									content: '这是评论内容',
									remark: []
								}
							]
						}
					]
				}
			};
		},
		onLoad(params) {
			console.log(params)
		    console.log(params.id);
			if(params.id != null)
				this.testData.id = params.id
		},
		methods: {
			sending() {
				if(this.remark.trim() == ''){
					this.remark = ''
					console.log('not remark!')
					uni.showToast({
						title: '内容不能为空!',
						icon: 'error', 
						duration: 2000 // 提示信息显示的时间（毫秒）
					});
				}else{
					console.log('remark: ', this.remark)
					this.remark = ''
				}
				
			}
		}
	}
</script>

<style lang="scss">

</style>
